<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libcoap: String handling support</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">libcoap<span id="projectnumber">&#160;4.2.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__string.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">String handling support</div></div>
</div><!--header-->
<div class="contents">

<p>API functions for handling strings.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structcoap__string__t.html">coap_string_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Coap string data definition.  <a href="structcoap__string__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structcoap__str__const__t.html">coap_str_const_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Coap string data definition with const data.  <a href="structcoap__str__const__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structcoap__binary__t.html">coap_binary_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Coap binary data definition.  <a href="structcoap__binary__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga607f236d46eb2b285bbfaae7588cea10" id="r_ga607f236d46eb2b285bbfaae7588cea10"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__string.html#ga607f236d46eb2b285bbfaae7588cea10">COAP_SET_STR</a>(st,  l,  v)&#160;&#160;&#160;{ (st)-&gt;length = (l), (st)-&gt;s = (v); }</td></tr>
<tr class="separator:ga607f236d46eb2b285bbfaae7588cea10"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3a9d1f377dc7a25aa8b6136a169f76c1" id="r_ga3a9d1f377dc7a25aa8b6136a169f76c1"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__string.html#ga3a9d1f377dc7a25aa8b6136a169f76c1">coap_make_str_const</a>(string)&#160;&#160;&#160;  (&amp;(<a class="el" href="structcoap__str__const__t.html">coap_str_const_t</a>){sizeof(string)-1,(const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *)(string)})</td></tr>
<tr class="memdesc:ga3a9d1f377dc7a25aa8b6136a169f76c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Take the specified byte array (text) and create a <a class="el" href="structcoap__str__const__t.html" title="Coap string data definition with const data.">coap_str_const_t</a> *.  <br /></td></tr>
<tr class="separator:ga3a9d1f377dc7a25aa8b6136a169f76c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7f43c10b486dc6d45c37fcaf987d711b" id="r_ga7f43c10b486dc6d45c37fcaf987d711b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__string.html#ga7f43c10b486dc6d45c37fcaf987d711b">coap_string_equal</a>(string1,  string2)</td></tr>
<tr class="memdesc:ga7f43c10b486dc6d45c37fcaf987d711b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compares the two strings for equality.  <br /></td></tr>
<tr class="separator:ga7f43c10b486dc6d45c37fcaf987d711b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga9c24e196cb4b1f8171771445cfc3e8ce" id="r_ga9c24e196cb4b1f8171771445cfc3e8ce"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structcoap__string__t.html">coap_string_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__string.html#ga9c24e196cb4b1f8171771445cfc3e8ce">coap_string_t</a></td></tr>
<tr class="memdesc:ga9c24e196cb4b1f8171771445cfc3e8ce"><td class="mdescLeft">&#160;</td><td class="mdescRight">Coap string data definition.  <br /></td></tr>
<tr class="separator:ga9c24e196cb4b1f8171771445cfc3e8ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga53b7b17631d12bf63ce9ff8fef192d6a" id="r_ga53b7b17631d12bf63ce9ff8fef192d6a"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structcoap__str__const__t.html">coap_str_const_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__string.html#ga53b7b17631d12bf63ce9ff8fef192d6a">coap_str_const_t</a></td></tr>
<tr class="memdesc:ga53b7b17631d12bf63ce9ff8fef192d6a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Coap string data definition with const data.  <br /></td></tr>
<tr class="separator:ga53b7b17631d12bf63ce9ff8fef192d6a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7f8af507a2e35ddcd798e207c14300bf" id="r_ga7f8af507a2e35ddcd798e207c14300bf"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structcoap__binary__t.html">coap_binary_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__string.html#ga7f8af507a2e35ddcd798e207c14300bf">coap_binary_t</a></td></tr>
<tr class="memdesc:ga7f8af507a2e35ddcd798e207c14300bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Coap binary data definition.  <br /></td></tr>
<tr class="separator:ga7f8af507a2e35ddcd798e207c14300bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga9862b1ade5e6e2eb01aabd0fa98b63e1" id="r_ga9862b1ade5e6e2eb01aabd0fa98b63e1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__string__t.html">coap_string_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__string.html#ga9862b1ade5e6e2eb01aabd0fa98b63e1">coap_new_string</a> (size_t size)</td></tr>
<tr class="memdesc:ga9862b1ade5e6e2eb01aabd0fa98b63e1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a new string object with at least size+1 bytes storage allocated.  <br /></td></tr>
<tr class="separator:ga9862b1ade5e6e2eb01aabd0fa98b63e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad991c87cfcf9b2414d2dc430c8701ed3" id="r_gad991c87cfcf9b2414d2dc430c8701ed3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__string.html#gad991c87cfcf9b2414d2dc430c8701ed3">coap_delete_string</a> (<a class="el" href="structcoap__string__t.html">coap_string_t</a> *string)</td></tr>
<tr class="memdesc:gad991c87cfcf9b2414d2dc430c8701ed3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes the given string and releases any memory allocated.  <br /></td></tr>
<tr class="separator:gad991c87cfcf9b2414d2dc430c8701ed3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaac769e3d5cea5481436c9eb3cb28d92a" id="r_gaac769e3d5cea5481436c9eb3cb28d92a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcoap__str__const__t.html">coap_str_const_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__string.html#gaac769e3d5cea5481436c9eb3cb28d92a">coap_new_str_const</a> (const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *data, size_t size)</td></tr>
<tr class="memdesc:gaac769e3d5cea5481436c9eb3cb28d92a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a new const string object with at least size+1 bytes storage allocated, and the provided data copied into the string object.  <br /></td></tr>
<tr class="separator:gaac769e3d5cea5481436c9eb3cb28d92a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4c283744d0fa51b553bf3fc52488e4b0" id="r_ga4c283744d0fa51b553bf3fc52488e4b0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__string.html#ga4c283744d0fa51b553bf3fc52488e4b0">coap_delete_str_const</a> (<a class="el" href="structcoap__str__const__t.html">coap_str_const_t</a> *string)</td></tr>
<tr class="memdesc:ga4c283744d0fa51b553bf3fc52488e4b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes the given const string and releases any memory allocated.  <br /></td></tr>
<tr class="separator:ga4c283744d0fa51b553bf3fc52488e4b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>API functions for handling strings. </p>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ga3a9d1f377dc7a25aa8b6136a169f76c1" name="ga3a9d1f377dc7a25aa8b6136a169f76c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3a9d1f377dc7a25aa8b6136a169f76c1">&#9670;&#160;</a></span>coap_make_str_const</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define coap_make_str_const</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">string</td><td>)</td>
          <td>&#160;&#160;&#160;  (&amp;(<a class="el" href="structcoap__str__const__t.html">coap_str_const_t</a>){sizeof(string)-1,(const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *)(string)})</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Take the specified byte array (text) and create a <a class="el" href="structcoap__str__const__t.html" title="Coap string data definition with const data.">coap_str_const_t</a> *. </p>
<p>WARNING: The byte array must be in the local scope and not a parameter in the function call as sizeof() will return the size of the pointer, not the size of the byte array, leading to unxepected results.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">string</td><td>The const byte array to convert to a <a class="el" href="structcoap__str__const__t.html" title="Coap string data definition with const data.">coap_str_const_t</a> * </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="str_8h_source.html#l00102">102</a> of file <a class="el" href="str_8h_source.html">str.h</a>.</p>

</div>
</div>
<a id="ga607f236d46eb2b285bbfaae7588cea10" name="ga607f236d46eb2b285bbfaae7588cea10"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga607f236d46eb2b285bbfaae7588cea10">&#9670;&#160;</a></span>COAP_SET_STR</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define COAP_SET_STR</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">st, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">l, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">v&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;{ (st)-&gt;length = (l), (st)-&gt;s = (v); }</td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="str_8h_source.html#l00038">38</a> of file <a class="el" href="str_8h_source.html">str.h</a>.</p>

</div>
</div>
<a id="ga7f43c10b486dc6d45c37fcaf987d711b" name="ga7f43c10b486dc6d45c37fcaf987d711b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7f43c10b486dc6d45c37fcaf987d711b">&#9670;&#160;</a></span>coap_string_equal</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define coap_string_equal</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">string1, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">string2&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">        ((string1)-&gt;length == (string2)-&gt;length &amp;&amp; ((string1)-&gt;length == 0 || \</div>
<div class="line">         memcmp((string1)-&gt;s, (string2)-&gt;s, (string1)-&gt;length) == 0))</div>
</div><!-- fragment -->
<p>Compares the two strings for equality. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">string1</td><td>The first string. </td></tr>
    <tr><td class="paramname">string2</td><td>The second string.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>1</code> if the strings are equal <code>0</code> otherwise. </dd></dl>

<p class="definition">Definition at line <a class="el" href="str_8h_source.html#l00115">115</a> of file <a class="el" href="str_8h_source.html">str.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a id="ga7f8af507a2e35ddcd798e207c14300bf" name="ga7f8af507a2e35ddcd798e207c14300bf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7f8af507a2e35ddcd798e207c14300bf">&#9670;&#160;</a></span>coap_binary_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structcoap__binary__t.html">coap_binary_t</a> <a class="el" href="structcoap__binary__t.html">coap_binary_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Coap binary data definition. </p>

</div>
</div>
<a id="ga53b7b17631d12bf63ce9ff8fef192d6a" name="ga53b7b17631d12bf63ce9ff8fef192d6a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga53b7b17631d12bf63ce9ff8fef192d6a">&#9670;&#160;</a></span>coap_str_const_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structcoap__str__const__t.html">coap_str_const_t</a> <a class="el" href="structcoap__str__const__t.html">coap_str_const_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Coap string data definition with const data. </p>

</div>
</div>
<a id="ga9c24e196cb4b1f8171771445cfc3e8ce" name="ga9c24e196cb4b1f8171771445cfc3e8ce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9c24e196cb4b1f8171771445cfc3e8ce">&#9670;&#160;</a></span>coap_string_t</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structcoap__string__t.html">coap_string_t</a> <a class="el" href="structcoap__string__t.html">coap_string_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Coap string data definition. </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga4c283744d0fa51b553bf3fc52488e4b0" name="ga4c283744d0fa51b553bf3fc52488e4b0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4c283744d0fa51b553bf3fc52488e4b0">&#9670;&#160;</a></span>coap_delete_str_const()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_delete_str_const </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__str__const__t.html">coap_str_const_t</a> *&#160;</td>
          <td class="paramname"><em>string</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Deletes the given const string and releases any memory allocated. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">string</td><td>The string to free off. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="str_8c_source.html#l00047">47</a> of file <a class="el" href="str_8c_source.html">str.c</a>.</p>

</div>
</div>
<a id="gad991c87cfcf9b2414d2dc430c8701ed3" name="gad991c87cfcf9b2414d2dc430c8701ed3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad991c87cfcf9b2414d2dc430c8701ed3">&#9670;&#160;</a></span>coap_delete_string()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void coap_delete_string </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcoap__string__t.html">coap_string_t</a> *&#160;</td>
          <td class="paramname"><em>string</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Deletes the given string and releases any memory allocated. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">string</td><td>The string to free off. </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="str_8c_source.html#l00034">34</a> of file <a class="el" href="str_8c_source.html">str.c</a>.</p>

</div>
</div>
<a id="gaac769e3d5cea5481436c9eb3cb28d92a" name="gaac769e3d5cea5481436c9eb3cb28d92a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaac769e3d5cea5481436c9eb3cb28d92a">&#9670;&#160;</a></span>coap_new_str_const()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__str__const__t.html">coap_str_const_t</a> * coap_new_str_const </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns a new const string object with at least size+1 bytes storage allocated, and the provided data copied into the string object. </p>
<p>The string must be released using <a class="el" href="group__string.html#ga4c283744d0fa51b553bf3fc52488e4b0" title="Deletes the given const string and releases any memory allocated.">coap_delete_str_const()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>The data to put in the new string object. </td></tr>
    <tr><td class="paramname">size</td><td>The size to allocate for the binary string data.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the new object or <code>NULL</code> on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="str_8c_source.html#l00038">38</a> of file <a class="el" href="str_8c_source.html">str.c</a>.</p>

</div>
</div>
<a id="ga9862b1ade5e6e2eb01aabd0fa98b63e1" name="ga9862b1ade5e6e2eb01aabd0fa98b63e1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9862b1ade5e6e2eb01aabd0fa98b63e1">&#9670;&#160;</a></span>coap_new_string()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcoap__string__t.html">coap_string_t</a> * coap_new_string </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns a new string object with at least size+1 bytes storage allocated. </p>
<p>The string must be released using <a class="el" href="group__string.html#gad991c87cfcf9b2414d2dc430c8701ed3" title="Deletes the given string and releases any memory allocated.">coap_delete_string()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">size</td><td>The size to allocate for the binary string data.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A pointer to the new object or <code>NULL</code> on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="str_8c_source.html#l00018">18</a> of file <a class="el" href="str_8c_source.html">str.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Fri Dec 27 2024 09:57:44 for libcoap by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
  </ul>
</div>
</body>
</html>
